//
//  MainTableViewController.m
//  BaseTools
//
//  Created by 李挺哲 on 15/8/11.
//  Copyright (c) 2015年 ltz. All rights reserved.
//

#import "MainTableViewController.h"
#import "BToolsViewController.h"
#import "BItMapViewController.h"
#import "NetWorkViewController.h"
#import "PersistenceViewController.h"
#import "SomeViewViewController.h"
#import "MultimediaViewController.h"
#import "DeviceViewController.h"
@interface MainTableViewController ()
{
    NSMutableArray * array;
    BToolsViewController *nvc;
    BItMapViewController *bitMapVc;
    NetWorkViewController * netWorkVc;
    PersistenceViewController *persistenceVc;
    SomeViewViewController *someViewVc;
    MultimediaViewController * MultimediaViewC;
    DeviceViewController *deviceVc;
}
@end

@implementation MainTableViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    array=[NSMutableArray array];
    [array addObject:@"基类使用"];
    [array addObject:@"图片相关"];
    [array addObject:@"网络相关"];
    [array addObject:@"界面相关"];
    [array addObject:@"持久化相关"];
     [array addObject:@"音视频相关"];
    [array addObject:@"硬件相关"];
//       [array addObject:@"断点续传"];
    
    NSLog(@"%ld",(unsigned long)array.count);
    UIStoryboard *story = [UIStoryboard  storyboardWithName:@"Main"   bundle:nil];
    nvc = [story instantiateViewControllerWithIdentifier:@"BToolsViewController"];
    
    bitMapVc=[[BItMapViewController alloc] init];
    netWorkVc=[[NetWorkViewController alloc] init];
    persistenceVc=[[PersistenceViewController alloc] init];
    someViewVc=[[SomeViewViewController alloc] init];
    MultimediaViewC=[[MultimediaViewController alloc] init];
    deviceVc= [[DeviceViewController alloc] init];
    [self.tableView reloadData];
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
}



-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    
    return 1;
    
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    
    
    return array.count;
    
}


-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    static NSString *reuseId = @"MainTableViewCell";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:reuseId];
    if (cell == nil) {
        cell=[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:reuseId];
    }
    cell.textLabel.textAlignment=NSTextAlignmentCenter;
    cell.textLabel.text=array[indexPath.row];
    return cell;

}

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    switch (indexPath.row) {
        case 0:
            [self showViewController:nvc sender:self];
            break;
        case 1:
            [self showViewController:bitMapVc sender:self];
            break;
        case 2:
            [self showViewController:netWorkVc sender:self];
            break;
        case 3:
             [self showViewController:someViewVc sender:self];
            break;
        case 4:
            [self showViewController:persistenceVc sender:self];
            
            break;
        case 5:
             [self showViewController:MultimediaViewC sender:self];
            break;
        case 6:
              [self showViewController:deviceVc sender:self];
            
            break;
        default:
            break;
    }
    
    
    
    
    
    
    
}


@end
